﻿using BankTransfer.Bank.Domain.Domain.Entity;
using BankTransfer.Bank.Types.Types;

namespace BankTransfer.Bank.Domain.Domain.Service.Impl
{
    public class AccountTransferServiceImpl : IAccountTransferService
    {
        public void Transfer(Account sourceAccount, Account targetAccount, Money targetMoney, ExchangeRate exchangeRate)
        {
            Money sourceMoney = exchangeRate.ExchangeTo(targetMoney);
            sourceAccount.Deposit(sourceMoney);
            targetAccount.Withdraw(targetMoney);
        }
    }
}